<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>history</h1>
<hr>
<input type="button" value="返回" onclick="goback()">
<input type="button" value="前进" onclick="goforward()">
<a href="https://www.baidu.com/">点我</a>
<script>
    function goback() {
        window.history.back();
        //或者
        //window.history.go(-1);
    }

    function goforward() {
        window.history.forward();
        //或者
        //window.history.go(1);
    }
</script>
</body>
</html>